package org.liulinlin.sejw.db;

import java.sql.*;

public class FeeItem {
	private int id;
	private String code;
	private String name;
	private String type;
	private String unitCode;
	private String unitName;
	private double std;
	
	public FeeItem() {
		
	}
	public FeeItem(int id) {
		DBConnectionManager connMgr = DBConnectionManager.getInstance();
		Connection con = connMgr.getConnection("shipping_export");
		if (con == null) {
			System.out.println("FeeItem不能获得数据库连接");
			return;
		}
		
		try {
			Statement stmt = con.createStatement();
			ResultSet rs = stmt.executeQuery("select * from FeeItem where Seq_ID = '" + id + "'");
		
			rs.next();
			this.id = id;
			code = rs.getString("Fee_Code");
			name = rs.getString("Fee_Name");
			type = rs.getString("Fee_Type");
			unitCode = rs.getString("Unit_Code");
			unitName = rs.getString("Unit_Name");
			std = rs.getDouble("Fee_Std");
			
			stmt.close();
			rs.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		connMgr.freeConnection("shipping_export", con);
		connMgr.release();
	}
	
	public void setId(int id) {
		this.id = id;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setType(String type) {
		this.type = type;
	}
	public void setUnitCode(String unitCode) {
		this.unitCode = unitCode;
	}
	public void setUnitName(String unitName) {
		this.unitName = unitName;
	}
	public void setStd(double std) {
		this.std = std;
	}
	
	public int getId() {
		return id;
	}
	public String getCode() {
		return code;
	}
	public String getName() {
		return name;
	}
	public String getType() {
		return type;
	}
	public String getUnitCode() {
		return unitCode;
	}
	public String getUnitName() {
		return unitName;
	}
	public double getStd() {
		return std;
	}
}
